package com.awplanet.sitegen.utils;

import java.util.Random;

/**
 * User: a_polyakov
 */
public class RandomUtils {
	public static int nextRandomInt(Random random, int minRandom, int maxRandom) {
		if (minRandom > maxRandom) {
			minRandom = maxRandom;
		}
		if (maxRandom > 0) {
			int range = 0;
			if (minRandom < maxRandom) {
				range = maxRandom - minRandom + 1;
				range = random.nextInt(range);
			}
			minRandom += range;
		}
		if (minRandom < 0) {
			minRandom = 0;
		}
		return minRandom;
	}
}
